package com.example.myapplication.found

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import com.example.myapplication.R
import com.example.myapplication.databinding.ActivityDealBinding

/**
 * @author: rongfeng
 * @date: 2022/6/8
 * @description
 */
class DealActivity : AppCompatActivity()  {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val binding: ActivityDealBinding = DataBindingUtil.setContentView(
            this, R.layout.activity_deal)
        binding.btnSubmit.setOnClickListener {
            val jijin = binding.et1.text.toString().toDouble()
            val zhaiquan = binding.et2.text.toString().toDouble()
            val zhangdie = binding.et4.text.toString().toFloat()

            Deal.simpleCallback = Deal.Callback {
                runOnUiThread {
                    binding.tvResult.text = it.toString()
                }
            }
            val deal = Deal()
            deal.jiJin3 = jijin
            deal.zhaiQuan3 = zhaiquan
            deal.zhangdie = zhangdie
            deal.start()
        }

    }
}